clear all;

load('mig.mat');

mig_lb(1:nz)=0;
mig_ub(1:nz)=0;
theta=0.8;
theta_index=find(gridtheta==theta);

for i=1:nz
    temp=find(mig_2to1(i,:,theta_index)==1);
    if ~isempty(temp)
        mig_lb(i)=min(temp);
        mig_ub(i)=max(temp);
    end
end

index=find(mig_lb,1,'first');

x_highkappa=gridb(mig_lb(index:end));
y_highkappa=gridz(index:end);

save('result_OA8_A.mat','x_highkappa','y_highkappa')